import { createRouter,createWebHistory } from "vue-router";

const router = createRouter({
    // 路由历史
    history:createWebHistory(),
    // 配置路由,可以配置多个路由
    routes:[
        {
            //路由路径
            path:"/",
            //对应路径的页面
            component:() => import('../view/login.vue')
        },
        {
            //路由路径
            path:"/dashboard",
            //对应路径的页面
            component:() => import('../view/dashboard.vue'),
            // 子路由
            children : [
                {
                    // 子路由的path开始不能有/
                    path:"",
                    //对应路径的页面
                    component:() => import('../view/StatisticView.vue'),
                },
                {
                    // 子路由的path开始不能有/
                    path:"user",
                    //对应路径的页面
                    component:() => import('../view/userView.vue'),
                },
                {
                    // 子路由路径
                    path:"user/detail/:id",
                    //路由路径所展示的页面
                    component : () => import('../view/userDetail.vue')
                },
                {
                    path:"activity",
                    component : () => import('../view/activityView.vue')
                },
                {
                    path:"activity/add",
                    component : () => import('../view/activityRecordView.vue')
                },
                {
                    path:"activity/edit/:id",
                    component : () => import('../view/activityRecordView.vue')
                },
                {
                    path:"activity/detail/:id",
                    component : () => import('../view/activityDetail.vue')
                },
                {
                    path:"clue",
                    component : () => import('../view/clueView.vue')
                },
                {
                    path:"clue/add",
                    component : () => import('../view/clueRecordView.vue')
                },
                {
                    path:"clue/edit/:id",
                    component : () => import('../view/clueRecordView.vue')
                },
                {
                    path:"clue/detail/:id",
                    component : () => import('../view/clueDetailView.vue')
                },
                {
                    path:"customer",
                    component : () => import('../view/customerView.vue')
                }
            ]
        }
    ]
});

export default router;